package com.bdqn.demo01.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdqn.demo01.entity.Account;
import com.bdqn.demo01.mapper.AccountMapper;
import com.bdqn.demo01.service.AccountService;
import org.springframework.stereotype.Service;
import java.util.Optional;

@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {
    @Override
    public Optional<Account> findByCardnoAndPassword(String cardno, String password) {
        QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("cardno", cardno).eq("password", password);
        return Optional.ofNullable(getOne(queryWrapper));
    }
}
